葫芦的运维日志
下一篇
搜索
上一篇
浏览量 4865
2019/10/23 17:32
解决axios post 提交x-www-form-urlencoded格式错乱:
<script>
import axios from 'axios'
import qs from 'qs';
export default {
name: 'Action',
data() {
return {
phone_wid: "",
openid: ""
}
},
methods: {
onSubmit() {
this.openid = ""
const url = "/go_action"
let param = {
'serviceName': '***',
'methodName': '**',
'paramterInput': `{\"appid\":'****',\"is_needTag\":false,\"pid\":**,\"source\":1,\"wid\":${this.phone_wid}}`
}
let data = qs.stringify(param)
console.log(data)
axios.post(url, data,
{
headers: {
'apiclient-auth': '******',
'Content-Type': 'application/x-www-form-urlencoded'
}
}
).then((res) => {
console.log(res.data.responseVo.infos[0].openid)
this.openid = res.data.responseVo.infos[0].openid
})
}
}
}
</script>
Form Data提交格式:
葫芦的运维日志
打赏
上一篇
搜索
下一篇